/**
 # # THIS FILE IS PART OF ripap PROJECT
 # #
 # MyNullArrayJsonSerializer.java - MyNullArrayJsonSerializer
 # 
 # THIS PROGRAM IS OPENSOURCE SOFTWARE, IS LICENSED UNDER BSD
 # YOU SHOULD HAVE RECEIVED A COPY OF WTFPL LICENSE
 # 
 # Copyright (c) 2018 Ting Fan
 */
package com.cloudkinto.config.json;


import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * @program     : ripap
 * @description : MyNullArrayJsonSerializer
 * @author      : Ting Fan
 * @company     : 苏州
 * @create      : 2019-05-10 15:42
 **/

public class MyNullArrayJsonSerializer extends JsonSerializer {

    @Override
    public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
        if (value == null) {
            jgen.writeStartArray();
            jgen.writeEndArray();
        }
    }

}
